package Terminal.View;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

import Terminal.View.Gestori.GestoreInterfaccia;

public class JBottoniTimeRecordNuovo extends JBottoniTimeRecord {
	private JButton nuovoTimerecord;
	private JButton startTimerecord;
	private JButton stopTimerecord;
	private JButton salvaNuovoTimerecord;
	private JButton annullaNuovoTimerecord;
	@Override
	public void createComponents() {

		this.setBounds(20, 601, 1280, 80);
		this.setLayout(null);
		setBottoni();
	//	this.setBackground(Color.WHITE);
		add(nuovoTimerecord);
		add(startTimerecord);
		add(stopTimerecord);
		add(salvaNuovoTimerecord);
		add(annullaNuovoTimerecord);
		setVisible(true);
	}
	private void setBottoni(){
		nuovoTimerecord = new JButton("Nuovo TimeRecord");
		nuovoTimerecord.setBounds(200,15,150,50);//100, 30,nuovoTimerecord.getPreferredSize().width,30);
		nuovoTimerecord.setEnabled(false);
		
		startTimerecord = new JButton("START TimeRecord");
		startTimerecord.setBounds(550, 15,startTimerecord.getPreferredSize().width,50);
		startTimerecord.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent arg0) {
				mediator.smista("GestireTimeRecord", "StartTimeRecord");
				
			}
		});
		
		stopTimerecord = new JButton("STOP TimeRecord");
		stopTimerecord.setBounds(700, 15, stopTimerecord.getPreferredSize().width, 50);
		stopTimerecord.setEnabled(false);
		stopTimerecord.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent arg0) {
				mediator.smista("GestireTimeRecord", "StopTimeRecord");
				
			}
		});
		
		salvaNuovoTimerecord = new JButton("Salva TimeRecord");
		salvaNuovoTimerecord.setBounds(1130,15,150,50);//900, 30, salvaNuovoTimerecord.getPreferredSize().width, 50);
		salvaNuovoTimerecord.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				mediator.smista("GestireTimeRecord", "SalvaNuovoTimeRecord");
				
			}
		});
		
		annullaNuovoTimerecord= new JButton("Annulla");
		annullaNuovoTimerecord.setBounds(970,15,150,50);//1100, 30, annullaNuovoTimerecord.getPreferredSize().width, 50);
		annullaNuovoTimerecord.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent arg0) {
				mediator.smista("GestireTimeRecord", "VisualizzaTimeRecord");
				
			}
		});
	}
	
	public void setDisabilitaBottoni(){
		startTimerecord.setEnabled(false);
		salvaNuovoTimerecord.setEnabled(false);
		annullaNuovoTimerecord.setEnabled(false);
		stopTimerecord.setEnabled(true);
	}
	
	public void setDisabilitaStart(){
		startTimerecord.setEnabled(false);
	}
	

}
